<template>
    <div class="login_page">
        <image class="w300 h300" src="https://sy-img.ttjiandan.com/owx/5/wxpubcode/20231025021345309097.png" mode="" />

        <div class="input mar30">
            <input class="pad-l10" v-model="code" type="text" placeholder="please enter code">
        </div>
        <button @click="login">登录</button>
    </div>
</template>

<script>
import { userOpenIdPcLogin } from '@/request/login'
export default {
    data() {
        return {
            code: 'oufYj6CwUeV_zgg6MNdvXMpHm3SE' //MADAO
            // code: 'oufYj6OfdLbNUmiGBynmNDJvTH3g' //阿仁
            // code: 'oufYj6NWJ0hSXUPECduYAM7pWhpE' //空白
        }
    },
    onLoad() {
        if(location.href.indexOf('local') > -1) {
            this.code = 'oufYj6NWJ0hSXUPECduYAM7pWhpE'
        } else {
            this.code = 'oufYj6CwUeV_zgg6MNdvXMpHm3SE'
        }
    },
    methods: {
        login() {
            userOpenIdPcLogin({
                code: this.code
            }).then(async res => {
                this.$store.commit('SET_ACCOUNT', res.data)
                await this.$refreshUserInfo()
                this.$navigate.switchTab('/pages/user')
            })
        }
    }

}
</script>

<style lang="less" scoped>
.login_page{
    display: flex;
    flex-direction: column;
    align-items: center;
}
.input {
    width: 100%;
    height: 80rpx;
    padding: 0 30rpx;
    input{
        background: #fff;
        border: 1px solid #ddd;
        width: 100%;
        height: 100%;
    }
}
button{
    width: 690rpx;
    border: 1px solid #ddd;
}

</style>